<template>
    <div>
        <br>
            <el-table
                    :data="dates"
                    border
                    style="width: 100%; margin-top: 20px">
                <el-table-column
                        label="开药日期"
                        align="center">
                    <template #default="scope">
                        {{scope.row}}
                    </template>
                </el-table-column>
                <el-table-column label="操作" width="180" align="center">

                    <template #default="scope">
                        <el-button  type="text" icon="el-icon-question" @click="handleEdit(scope.$index, scope.row)">查看
                        </el-button>

                    </template>
                </el-table-column>
            </el-table>
        <center>
            <el-pagination
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange"
                    :current-page="currentPage"
                    :page-sizes="[5, 10, 20, 40]"
                    :page-size="pagesize"
                    layout="total, sizes, prev, pager, next, jumper"
                    :total="dates.length"
            >
            </el-pagination>
        </center>
    </div>
</template>

<script>
    import axios from "axios";

    export default {
        name: "PatientPay",
        data() {

            return {
                dates:'',
                dates:[],
                currentPage:1, //初始页
                pagesize:5,    //    每页的数据
                dialogFormVisible: false,
            }
        },
        activated(){
            this.getdates();
        },
        methods: {
            handleSizeChange: function (size) {
                this.pagesize = size;
            },
            handleCurrentChange: function(currentPage){
                this.currentPage = currentPage;

            },
            getdates(){
                this.id=localStorage.getItem("id");
                axios.post("http://119.29.60.153:8001/doctorservice/prescription/getAllDate?id="+this.id).then(resp=> {
                    this.dates=resp.data.data.dates;
                })
            },
            handleEdit(index, row){
                localStorage.setItem('date',row);
                this.$router.push({name:'MedicineList',})
            }

        },
    }
</script>

<style scoped>

</style>